<?php

/**
 * @BelongProject: flami_mangers
 * @Author: Zwc
 * @CreateTime: 2025-11-16 14:20:14
 * @Description: TODO
 */

namespace App\Domain;

use function PhalApi\DI;

class VipExplainDomain
{
    /**
     * 获取会员权益
     * @param $langId
     * @return array
     */
    public static function getVipExplainByLangId($langId): array
    {
        if (empty($langId)) {
            $langId = LangDataDomain::getDefaultLangData();
        }

        $condition = 'del_flag = 0 and lang_id = ' . $langId;

        $dataList = DI()->notorm->vip_explain
            ->where($condition)
            ->fetchAll();
        if (empty($dataList)) {
            $langId = LangDataDomain::getDefaultLangData();
            return self::getVipExplainByLangId($langId);
        }
        $resData = [];
        foreach ($dataList as $v) {
            $arr = [
                'name' => $v['name'],
                'explain' => $v['explain'],
                'iconSrc' => \App\get_upload_path($v['icon_src']),
            ];
            $resData[] = $arr;
        }
        return $resData;
    }


}